<?php
namespace BABA\Omnipay;

use System\Classes\PluginBase;
use Backend;
use Lang;

use Omnipay\Omnipay;

/**
 * This class allows the plugin to be registered on October CMS.
 *
 * This plugin offers out-of-the-box integration with Mollie and PayPal Express.
 * It also offers integration with Stripe.
 */
class Plugin extends PluginBase
{
    /** @var array This is an array of required plugins. */
    public $require = [];

    /**
     * Register available components for this plugin.
     *
     * These components will be available in the CMS section of October CMS.
     *
     * @return array The available components for this plugin.
     */
    public function registerComponents()
    {
        return [
            'BABA\Omnipay\Components\Pay' => 'pay',
            'BABA\Omnipay\Components\Paid' => 'paid'
        ];
    }

    /**
     * Register settings for this plugin.
     *
     * These settings will be available on the settings page of October CMS.
     *
     * @return array The available settings for this plugin.
     */
    public function registerSettings()
    {
        return [
            'settings' => [
                'label'       => Lang::get('baba.omnipay::lang.settings.label'),
                'description' => Lang::get('baba.omnipay::lang.settings.description'),
                'category'    => 'Omnipay',
                'icon'        => 'icon-cog',
                'class'       => 'BABA\Omnipay\Models\Settings',
                'order'       => 500,
                'keywords'    => 'Omnipay',
                'permissions' => ['baba.omnipay.settings']
            ]
        ];
    }

    /**
     * Register permissions for this plugin.
     *
     * These permissions will be available on the settings page of October CMS.
     *
     * @return array The available settings for this plugin.
     */
    public function registerPermissions()
    {
        return [
            'baba.omnipay.settings' => [
                'tab' => Lang::get('baba.omnipay::lang.plugin.name'),
                'label' => Lang::get('baba.omnipay::lang.permissions.label'),
            ],
        ];
    }
}
